995bfed3fa6d6d0a2278cc1ff7b055692224b84d,src/the8472/mldht/indexing/TorrentDumper.java,TorrentDumper,dumpStats,#,274

Before Change


				
				Path statsFile = s.statsName(statsDir, null);
				
				Files.createDirectories(statsFile.getParent());

				// TODO: atomic-move
				try(FileChannel ch = FileChannel.open(statsFile, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE)) {

After Change


					ByteBuffer buf = new BEncoder().encode(s.forBencoding(), 16*1024);
					ch.write(buf);
					ch.close();
					Files.createDirectories(statsFile.getParent());
					Files.move(tempFile, statsFile, StandardCopyOption.ATOMIC_MOVE);
				} finally {
					Files.deleteIfExists(tempFile);